<template>
	<view class="shop-view">
		<view class="nav-bar" style="height:44px ;">
			<view class="title" style="color: #fff ;background: #fff linear-gradient(90deg, #d7b075, #aa8050); padding: 0 200rpx;">门店</view>
		</view>
		
		<view style="height:44px ;"></view>
		<view class="list">
			<view class="item" v-for="(item,index) in technicianList" :key="index" @click="gotoUrl(item)">
				<view class="top flex">
					<view class="left">
						<image v-if="checkId == 1" :src="$common.binImage(item.mainImg)" mode="aspectFill"></image>
						<image v-if="checkId == 2" :src="$common.binImage(item.headImg)" mode="aspectFill"></image>
					</view>
					<view class="right">
						<view class="name">{{item.storeName || item.nickName}}</view>
						<view class="address">{{item.address || '未设置地址'}}</view>
						<view v-if="item.distance" class="distance flex">
							<span>距离您{{ $common.distance(item.distance)}}</span>
						</view>
						<view v-if="item.customerVisit" class="num">{{item.customerVisit}}人去过</view>
					</view>
				</view>
				
			</view>
		</view>
	</view>
</template>

<script>
	import indexConfig from '@/config/index.config';
	export default {
		data() {
			return {
				imgUrl: indexConfig.imgUrl,
				technicianList: [],
				checkId: 1,
				searchValue:'',
			};
		},
		onLoad() {
			this.getStoreList();
		},
		onShow() {
			uni.setTabBarStyle({
				"backgroundColor": "#ffffff",
				"color": "#B8B8B8",
				"selectedColor": "#aa8050",
			})
		},
		methods: {
			gotoUrl(item) {
				if(this.checkId == 1){
					uni.navigateTo({
						url: '/pages/storeDetail/storeDetail?id=' + item.accountId
					})
				}else{
					uni.navigateTo({
						url: '/pages/technicianDetail/technicianDetail?id=' + item.id
					})
				}
				
			},
			getStoreList(){
				let {
					location
				} = this.$mStore.state
				this.$http.get('/appNoAuth/store/massageTechnician/listOfflineStore', {
					latitude: location.latitude,
					longitude: location.longitude,
					searchValue:this.searchValue,
				}).then(res => {
					this.technicianList = res.rows
				})
			}
		}
	}
</script>
<style>
page {
	background-color:  #ffffff;
}
</style>
<style lang="scss" scoped>
	.nav-bar {
		width: 100%;
		height: calc(var(--status-bar-height) + 196rpx);
		background: #f5f5f5;
		position: fixed;
		top: 0;
		left: 0;
		z-index: 99999;
		padding-top: var(--status-bar-height);
		box-sizing: border-box;

		.title {
			height: 80rpx;
			color: #333333;
			font-size: 36rpx;
			font-weight: 700;
			line-height: 80rpx;
			text-align: center;
		}

		.ipt {
			width: 694rpx;
			height: 70rpx;
			background: #FFFFFF;
			border-radius: 36rpx;
			margin: 20rpx auto;
			box-sizing: border-box;
			padding: 0 22rpx;

			input {
				height: 60rpx;
				font-size: 28rpx;
				font-weight: 500;
				text-align: LEFT;
				color: #929292;
				line-height: 60rpx;
				flex: 1;
				margin-left: 16rpx;
			}
		}
	}

	page {
		background-color: #fff;
	}

	.shop-view {
		background: #f5f5f5;
		min-height: calc(100vh - 100rpx);
	}

	.list {
		display: block;
		background-color: #FFFFFF;
		padding: 0 28rpx;

		.item {
			border-bottom: 2px solid #F5F5F5;
			padding: 28rpx 0;

			.line {
				.left {
					justify-content: flex-end;
					width: 246rpx;
					padding-right: 20rpx;
					box-sizing: border-box;

					.uni-label-pointer {
						background: linear-gradient(90deg, #ff6251, #ffab7f);
						border-radius: 5px;
						color: #fff;
						width: 120rpx;
						height: 40rpx;
						line-height: 40rpx;
						text-align: center;
						font-size: 22rpx;
					}
				}

				.right {
					height: 60rpx;
					border-bottom: 2rpx solid #eee;
					font-size: 22rpx;
					color: #999;
					flex: 1;

					&::after {
						content: "";
						display: block;
						width: 4px;
						height: 6px;
						background: url(/static/arrow-r.png) no-repeat;
						background-size: 100% auto;
						margin-left: 10px;
					}

					&::before {
						content: "";
						display: block;
						width: 30rpx;
						height: 30rpx;
						background: url(/static/bao.png) no-repeat;
						background-size: 100% auto;
						margin-right: 8rpx;
					}
				}

				.span1 {
					color: #e02020;
					width: 82rpx;
				}

				.span2 {
					width: 82rpx;
					text-decoration: line-through;
				}

				.span3 {
					width: 234rpx;
					overflow: hidden;
					text-overflow: ellipsis;
					white-space: nowrap;
				}
			}

			.top {

				.left {
					width: 200rpx;
					height: 200rpx;

					image {
						width: 200rpx;
						height: 200rpx;
						background: #fff;
						box-shadow: 0 0 4rpx 0 rgba(0, 0, 0, .1);
						border-radius: 10rpx;
					}
				}

				.right {
					color: #333;
					flex: 1;
					margin-left: 20rpx;

					.name {
						font-size: 30rpx;
						font-weight: 700;
						margin-bottom: 10rpx;
						width: 480rpx;
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;
					}

					.address {
						font-size: 26rpx;
						margin-bottom: 10rpx;
						width: 480rpx;
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;
					}

					.distance {
						color: #666;
						font-size: 24rpx;
						margin-bottom: 14rpx;

						&::before {
							display: block;
							content: "";
							width: 20rpx;
							height: 24rpx;
							background: url(/static/weizhi.png) no-repeat;
							background-size: 100% auto;
							margin-right: 10rpx;
						}
					}

					.num {
						display: inline-block;
						min-width: 128rpx;
						padding: 0 10rpx;
						height: 40rpx;
						line-height: 40rpx;
						background: linear-gradient(270deg, #fcf8f3, #ffece8 48%, #f8efe3);
						border-radius: 10rpx;
						text-align: center;
						color: #dd6d56;
						font-size: 20rpx;
						margin-bottom: 14rpx;
					}
				}
			}
		}
	}

	.tabbar {
		width: 710rpx;
		height: 80rpx;
		background: #f4f4f4;
		border-radius: 20rpx;
		position: -webkit-sticky;
		position: sticky;
		left: 20rpx;
		top: 108rpx;
		margin: 0 auto 20rpx;
		z-index: 10;
		display: flex;

		>view {
			text-align: center;
			line-height: 80rpx;
			position: relative;
			font-size: 36rpx;
			font-weight: 700;
			color: #9e9e9e;

			&:first-child {
				margin-right: 80rpx;
			}
		}

		.check {
			color: #333;
			font-weight: 700;

			&::after {
				display: block;
				content: "";
				width: 136rpx;
				height: 6rpx;
				background: linear-gradient(273deg, #aa8050 0%, #d7b075 100%);
				border-radius: 4rpx;
				position: absolute;
				left: 50%;
				bottom: 4rpx;
				-webkit-transform: translateX(-50%);
				transform: translateX(-50%);
			}
		}
	}

	.todayPrice {
		width: 710rpx;
		height: 370rpx;
		background: linear-gradient(300deg,#aa8050 0%, #fbcd8a 100%);
		box-shadow: 0 0 8rpx 0 rgba(0, 0, 0, .06);
		border-radius: 20rpx;
		margin: 0 auto 30rpx;

		.list {
			width: 690rpx;
			height: 290rpx;
			background: #fff;
			border-radius: 20rpx;
			margin: auto;
			box-sizing: border-box;
			padding: 0 30rpx;

			.item {
				width: 180rpx;
				margin-right: 44rpx;
				border: none;

				.name {
					line-height: 28rpx;
					color: #333;
					font-size: 20rpx;
					overflow: hidden;
					text-overflow: ellipsis;
					white-space: nowrap;
				}

				.img {
					width: 180rpx;
					height: 180rpx;
					background: #fff;
					box-shadow: 0 0 4rpx 0 rgba(0, 0, 0, .1);
					border-radius: 10rpx;
					margin-bottom: 4rpx;
				}

				.price {
					align-items: flex-end !important;
					line-height: 28rpx;

					.label-pointer {
						color: #e02020;
						font-weight: 700;
						font-size: 18rpx;
					}

					.span1 {
						font-size: 30rpx;
						font-weight: 700;
					}

					.span2 {
						font-weight: 400;
					}

					.span3 {
						color: #999;
						font-size: 20rpx;
						margin-left: 10rpx;
						text-decoration: line-through;
					}


				}
			}
		}

		.title {
			color: #fff;
			padding: 0 20rpx 0 30rpx;
			height: 70rpx;

			.arrow {
				font-size: 24rpx;

				&::after {
					content: "";
					width: 5px;
					height: 9px;
					background: url(/static/white-arrow-right.png) no-repeat;
					background-size: 100% auto;
					margin-left: 3px;
				}
			}

			.text2 {
				font-size: 26rpx;
				flex: 1;
			}

			.text1 {
				font-size: 34rpx;
				font-weight: 700;
				margin-right: 20rpx;
			}
		}
	}

	.orders {
		width: 100%;
		height: 80rpx;
		box-sizing: border-box;
		padding: 0 20rpx;
		margin-bottom: 20rpx;
	}

	.addWechatBox {
		padding: 0 20rpx 20rpx;

		.inner {
			width: 710rpx;
			height: 80rpx;
			background: #fdf6f2;
			border-radius: 40rpx;
			box-sizing: border-box;
			padding: 0 20rpx;

			>view {
				flex: 1;
				font-size: 28rpx;
				color: #fe7e75;
			}

			button {
				width: 140rpx;
				height: 50rpx;
				line-height: 50rpx;
				text-align: center;
				background: linear-gradient(270deg, #ffceb2, #fe7c73);
				border-radius: 30rpx;
				color: #fff;
				font-size: 26rpx;
				padding: 0;

				&::after {
					border: none;
				}
			}

			&::before {
				content: "";
				width: 36rpx;
				height: 32rpx;
				background: url(https://m.angemo.com/static/store/index/tips.png) no-repeat;
				background-size: 100% auto;
				margin-right: 10rpx;
			}
		}
	}
</style>
